package org.gap.jseed.util;

public class EqualsUtil {
	private static final int BOTH_NULL = 0, FIRST_NULL = 1, SECOND_NULL = 2, NEITHER_NULL = 3; 
	
	public static boolean equals(Object first, Object second) {
		int nullState = (first == null? 0: 1) + (second == null? 0: 2);
		switch(nullState) {
			case BOTH_NULL: return true;
			case FIRST_NULL: return false;
			case SECOND_NULL: return false;
			case NEITHER_NULL: return first.equals(second);
		}
		return false;
	}
	
	public static boolean notEquals(Object first, Object second) {
		return !equals(first, second);
	}
}
